package cn.xopencode.recordservice.manager.robotroom;

import cn.xopencode.common.framework.vo.PageResult;
import cn.xopencode.recordservice.convert.robotroom.AdminRecordConvert;
import cn.xopencode.recordservice.convert.robotroom.RobotRoomRecordConvert;
import cn.xopencode.recordservice.rpc.robotroom.dto.AdminRecordPageDTO;
import cn.xopencode.recordservice.rpc.robotroom.dto.RobotRoomRecordCreateDTO;
import cn.xopencode.recordservice.rpc.robotroom.dto.RobotRoomRecordPageDTO;
import cn.xopencode.recordservice.rpc.robotroom.dto.RobotRoomRecordUpdateDTO;
import cn.xopencode.recordservice.rpc.robotroom.vo.AdminRecordListVO;
import cn.xopencode.recordservice.rpc.robotroom.vo.RobotRoomRecordAdminPageVO;
import cn.xopencode.recordservice.rpc.robotroom.vo.RobotRoomRecordPageVO;
import cn.xopencode.recordservice.rpc.robotroom.vo.RobotRoomRecordUpdateVO;
import cn.xopencode.recordservice.service.robotroom.RobotRoomRecordService;
import cn.xopencode.recordservice.service.robotroom.bo.AdminRecordPageBO;
import cn.xopencode.recordservice.service.robotroom.bo.RobotRoomRecordCreateBO;
import cn.xopencode.recordservice.service.robotroom.bo.RobotRoomRecordUpdateBO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RobotRoomRecordManager {

    @Autowired
    private RobotRoomRecordService robotRoomRecordService;

    public PageResult<RobotRoomRecordPageVO> pageRobotRoomRecord(RobotRoomRecordPageDTO pageDTO){
        return robotRoomRecordService.pageRobotRoomRecord(RobotRoomRecordConvert.INSTANCE.convert(pageDTO));
    }

    public RobotRoomRecordUpdateVO getRobotRoomRecordById(String id){
        return robotRoomRecordService.getRobotRoomRecordById(id);
    }

    public Integer createRobotRoomRecord(RobotRoomRecordCreateDTO createDTO){
        RobotRoomRecordCreateBO createBO = RobotRoomRecordConvert.INSTANCE.convert(createDTO);
        return robotRoomRecordService.createRobotRoomRecord(createBO, createDTO.getEmpIds());
    }

    public Integer updateRobotRoomRecord(RobotRoomRecordUpdateDTO updateDTO){
        RobotRoomRecordUpdateBO updateBO = RobotRoomRecordConvert.INSTANCE.convert(updateDTO);
        return robotRoomRecordService.updateRobotRoomRecord(updateBO, updateDTO.getEmpIds());
    }

    public Integer dealRobotRoomRecordException(String recordId){
        return robotRoomRecordService.dealRobotRoomRecordException(recordId);
    }

    /**
     * 获取 后台管理中巡检记录列表
     */
    public List<AdminRecordListVO> getAdminRecordList(){
        return robotRoomRecordService.getAdminRecordList();
    }

    public PageResult<RobotRoomRecordAdminPageVO> getAdminPageRobotRoomRecord(AdminRecordPageDTO pageDTO){
        AdminRecordPageBO pageBO = AdminRecordConvert.INSTANCE.convert(pageDTO);
        return robotRoomRecordService.getAdminPageRobotRoomRecord(pageBO);
    }
}
